package com.soft.mainsite.module.sitecode.web;

import com.soft.mainsite.common.domain.RestResponse;
import com.soft.mainsite.module.sitecode.entity.SiteCode;
import com.soft.mainsite.module.sitecode.service.SiteCodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * SiteCodeController.java 此类用于数据字典控制层
 *
 * @author:李昭阳
 * @date:2019/5/14 0014
 * @remark:
 */
@RestController
@RequestMapping("/siteCode")
public class SiteCodeController {
    @Autowired
    private SiteCodeService siteCodeService;

    /**
     * 根据父id获取站点
     * @return
     */
    @RequestMapping("/listByPid")
    @ResponseBody
    public RestResponse<List<SiteCode>> listByPid(Integer pid){
        List<SiteCode> siteCodes = siteCodeService.listByPid(pid);
        return RestResponse.success(siteCodes);
    }
}
